package com.sbp.message.api.entity;

import java.io.Serializable;

public enum LocalRecordStatus implements Serializable {
    succeed(0),           // 成功生成 或 成功消费
    businessFailed(1),    // 业务异常, 只能人工介入解决
    processing(2);        // 正在处理消息
    protected static final LocalRecordStatus defaultEnum = succeed;

    protected final int value;
    private LocalRecordStatus(int value) {
        this.value = value;
    }

    public int getValue() {
        return this.value;
    }
    public static int getValue(LocalRecordStatus status) {
        if (status == null)
            return defaultEnum.value;
        else
            return status.value;
    }
    public static LocalRecordStatus valueOf(int value, boolean returnDefault) {
        LocalRecordStatus[] list = LocalRecordStatus.values();
        for (int i=0; i<list.length; ++i) {
            if (list[i].value == value)
                return list[i];
        }

        if (returnDefault)
            return defaultEnum;
        else
            return null;
    }
}
